package cn.tedu.charging.order.dao.repository.impl;


import cn.tedu.charging.order.dao.mapper.OrderFaileMapper;
import cn.tedu.charging.order.dao.mapper.OrderSuccessMapper;
import cn.tedu.charging.order.dao.repository.OrderRepository;
import cn.tedu.charging.order.pojo.po.ChargingOrderFailPO;
import cn.tedu.charging.order.pojo.po.ChargingOrderSuccessPO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class OrderRepositoryImpl  implements OrderRepository {
    @Autowired
    OrderSuccessMapper orderSuccessMapper;
    @Autowired
    OrderFaileMapper orderFailMapper;


    @Override
    public ChargingOrderSuccessPO getSuccessOrder(String orderNo) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("bill_id",orderNo);
        return orderSuccessMapper.selectOne(queryWrapper);

    }

    @Override
    public ChargingOrderFailPO getFailOrder(String orderNo) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("bill_id",orderNo);
        return orderFailMapper.selectOne(queryWrapper);
    }

    @Override
    public Integer saveFailOrder(ChargingOrderFailPO po) {
        return orderFailMapper.insert(po);
    }
}
